
Instructions for replicating analyses presented in Kim, In Song, 
Jan Stuckatz, and Lukas Wolters. "Systemic and Sequential Links.
between Campaign Donations and Lobbying" 2014. Journal of Politics, 
Forthcoming.

######################################################################
*** I. Folder Structure *** 
######################################################################

Note that users will need to have the following three folders in their
directory:
- code: contains all *.R files
- data:  contains all data files, including folders in "panelmatch_objects.zip"
- output: tables and figures are output into that folder

*** Note:Users will have to adjust the directories in the beginning of
each *.R file to the paths on their respective machine. ***

The PanelMatch objects are located in the sub-folders of the "data" folder, 
as indicated below in section **VI**. Ensure that the necessary subfolders are correctly
placed under the "data" folder. 

For example, the file in the 'fig3' folder should be located
as follows: '<main replication
folder>/data/fig3/MSets_manuf_ann_house_maha_AnyDon_AnyLob'.

- fig3
- fig4
- fig5
- figI1
- figJ2
- figK1

######################################################################
*** II. Install Dependencies *** 
######################################################################

Replication created using R (version 4.3.3). Please install the
following R packages used in the analyses.

- PanelMatch: version = 2.0.1

Some of the models and figures were created using previous development
versions of PanelMatch, prior to the current release. We have included
the file "PanelMatch_2.0.1.tar.gz" in the main folder of the
replication packet. Please install this version of R to accurately
reproduce the figures. Note that the updated version of the PanelMatch
package may display rows differently when producing the treatment
variation plot, such as in Figure 2 of the manuscript.

You can install this version of PanelMatch by running the following
code:
install.packages("./PanelMatch_2.0.1.tar.gz", repos = NULL, type="source")


Please see the respective *.R files which version to install
to re-produce the respective output:
	
	devtools::install_github("insongkim/PanelMatch", dependencies=TRUE, ref = "big_data_checks")
	-> See the *.R files for which models to install the above development version.
	
	devtools::install_github("insongkim/PanelMatch", dependencies=TRUE, ref = "se_comparison")
	-> See the *.R files for which models to install the above development version.

*** Note: in case users encounter compiling errors with a message
"library not found for -lgfortran", please install all mandatory tools
and libraries listed in the following link: https://cran.rstudio.com/
***

- dplyr: version = 1.1.4         
- readr: version = 2.1.5       
- tidyr: version = 1.3.1       
- tibble: version = 3.2.1      
- ggplot2: version = 3.5.0     
- tidyverse: version = 2.0.0   
- data.table: version = 1.15.4
- lfe: version = 3.0-0
- stargazer: version = 5.2.3
- kableExtra: version = 1.4.0



######################################################################
*** III. R codes for the Main Analyses ***
######################################################################

The R scripts below will reproduce all the figures and tables in the
manuscript. Please set the working directory to where this instruction
file is located by changing MAIN_DIR in each R script.

*** Note: The MAIN_DIR in the R files below is currently set to:
C:/Users/js.egb/Dropbox/campaign-lobby-paper/replication_package. This
directory should contain the three primary subfolders of the
replication package: "code", "data", and "output". Ensure that
MAIN_DIR object, in the following 6 R codes, is set correctly to
maintain this folder/subfolder structure, such as <your MAIN_DIR>/code
***

- Replicate the figures in the main text.

[1] "Figure_1.R" creates Figure 1
[2] "Figure_2.R" creates Figure 2
[3] "Figure_3.R" creates Figure 3
[4] "Figure_4.R" creates Figure 4
[5] "Figure_5.R" creates Figure 5 
[6] "Table_1.R" creates Table 1


*** Note: if you need to replicate the figures and tables in the appendix,
please use the following R scripts. ***

 [1] "Figure_D1.R" creates Figure D.1
 [2] "Figure_E1.R" creates Figure E.1
 [3] "Figure_F1.R" creates Figure F.1
 [4] "Figure_G1.R" creates Figure G.1
 [5] "Figure_I1.R" creates Figure I.1
 [6] "Figure_K1.R" creates Figure K.1
 [7] "Table_D1.R" creates Table D.1
 [8] "Table_H1.R" creates Table H.1
 [9] "Table_H2.R" creates Table H.2
[10] "Table_H3.R" creates Table H.3
[11] "Table_H4.R" creates Table H.4
[12] "Table_H5.R" creates Table H.5
[13] "Table_J1.R" creates Table J.1
[14] "Table_J2.R" creates Table J.2
[15] "Table_J3.R" creates Table J.3
[16] "Table_K1.R" creates Table K.1
[17] "Table_L1.R" creates Table L.1


######################################################################
*** IV. Datasets ***
######################################################################

The following datasets used in the analyses. 
Please make sure to download all files in their original format.


- d_final_20210127.RData: dataset with firm-politician lobbying and d
onation activity from 2000 to 2018. Version from October 27, 2021, 
used in Figure 1, Table D.1, Figure D.1, Figure E.1, and Figure F.1.

- don_lob_all_ind_20210203.rds: expanded panel data at firm-legislator-year level, 
with lobbying and donation information  used in the PanelMatch and OLS analyses. 
Used in Table 1, Figure 2, Figure I.1, Table 1, Table H.1-5, Table J.1, Table J.2.,
and Table J.3

- don_lob_quarter_20210525_senate.csv: panel dataset at firm-senator-quarter 
level, with lobbying and donation activity. Used to produce Figure K.1 and Table K.1.



######################################################################
*** V. Additional Datasets ***
######################################################################

- compustat_1954_2018_deduped.csv: Compustat panel data with sales and employee
data, and various other firm characteristics at the firm-year-level, 
used in the PanelMatch and OLS analyses. Used in Figure F.1.

- compustat_deduped_20210119.RData: Compustat panel data with sales and employee
data at the firm-year-level used in the PanelMatch and OLS analyses. Used in Table D.1.

- lobby_pac_1999\_2000_replication.csv: Used in Figure G.1 to replicate the results in: 
Ansolabehere, Stephen, James M. Snyder and Micky Tripathi. 2002. "Are PAC Contributions and
Lobbying Linked? New Evidence from the 1995 Lobby Disclosure Act". 
Business and Politics 4(2):131--155.

- mtb_final.csv: dataset with descriptive information on miscellaneous 
tariff bills in 110th and 111th Congress, used in section L of the appendix. 

- mtb_desc_final.csv: cross-sectional dataset on miscellaneous tariff bills (MTBs) 
in 110th and 111th Congress, inlcuding donation and lobbying information. 
Used in Table L.1.

- mtb_final_panel.csv: panel dataset at firm-quarter level, on miscellaneous tariff 
bills (MTBs) in 110th and 111th Congress, inlcuding donation and lobbying 
information. Used in Table L.1.

- panelmatch_objects.zip: contains folders with PanelMatch objects 
(estimation objects and matched set objects) estimated using high-performance 
clusters. The folders contain the objects to create the respective figures 
in the main text and the appendix. See README.txt for a detailed list 
of the PanelMatch objects.

- senate_fec_to_govtrack_fastlink_COMPLETE.csv: legislator dataset containing 
legislator characteristics linked to Govtrack ID and various other unique IDs for 
legislators. Used in Figure F.1. Legislator characteristics come from: 
Volden, Craig and Alan E. Wiseman. 2018. "Legislative Effectiveness 
in the United States Senate." Journal of Politics 80(2):731--735.




######################################################################
*** VI. Output Files from PanelMatch ***
######################################################################

Note that the files below in the folders in "panelmatch_objects.zip".
These are outputs from PanelMatch analyses that were ran on a high-performance
cluster with at least 128 GB RAM and 28 cores. The  *.R files 
for the respective tables and figures contain the code used to create the
PanelMatch output files. 

See here for information on the hardware specification of the cluster:
https://researchcomputing.princeton.edu/systems/della

For Figure 3, Figure 4, and Table J.1
-- put in data/fig4 +
[1] "EstObj_manuf_ann_house_maha_AnyDon_AnyLob": for Figure 4 
[2] "EstObj_manuf_ann_senate_maha_AnyDon_AnyLob": for Figure 4
-- put in data/fig3
[3] "MSets_manuf_ann_house_maha_AnyDon_AnyLob": for Figure 3  
[4] "MSets_manuf_ann_senate_maha_AnyDon_AnyLob": for Figure 3

For Figure 5 and Table J.3
-- put in data/fig5
 [1] "EstObj_manuf_ann_senate_maha_AnyDon_CommLob"
 [2] "EstObj_manuf_ann_senate_maha_AnyDon_CoSpLob"
 [3] "EstObj_manuf_ann_senate_maha_AnyDon_SpLob"  
 [4] "EstObj_manuf_ann_senate_maha_CeoDon_AnyLob" 
 [5] "EstObj_manuf_ann_senate_maha_CeoDon_CommLob"
 [6] "EstObj_manuf_ann_senate_maha_CeoDon_CoSpLob"
 [7] "EstObj_manuf_ann_senate_maha_CeoDon_SpLob"  
 [8] "EstObj_manuf_ann_senate_maha_EmpDon_AnyLob" 
 [9] "EstObj_manuf_ann_senate_maha_EmpDon_CommLob"
[10] "EstObj_manuf_ann_senate_maha_EmpDon_CoSpLob"
[11] "EstObj_manuf_ann_senate_maha_EmpDon_SpLob"  
[12] "EstObj_manuf_ann_senate_maha_GovDon_AnyLob" 
[13] "EstObj_manuf_ann_senate_maha_GovDon_CommLob"
[14] "EstObj_manuf_ann_senate_maha_GovDon_CoSpLob"
[15] "EstObj_manuf_ann_senate_maha_GovDon_SpLob"  
[16] "EstObj_manuf_ann_senate_maha_PacDon_AnyLob" 
[17] "EstObj_manuf_ann_senate_maha_PacDon_CommLob"
[18] "EstObj_manuf_ann_senate_maha_PacDon_CoSpLob"
[19] "EstObj_manuf_ann_senate_maha_PacDon_SpLob"  
[20] "MSets_manuf_ann_senate_maha_AnyDon_CommLob" 
[21] "MSets_manuf_ann_senate_maha_AnyDon_CoSpLob" 
[22] "MSets_manuf_ann_senate_maha_AnyDon_SpLob"   
[23] "MSets_manuf_ann_senate_maha_CeoDon_AnyLob"  
[24] "MSets_manuf_ann_senate_maha_CeoDon_CommLob" 
[25] "MSets_manuf_ann_senate_maha_CeoDon_CoSpLob" 
[26] "MSets_manuf_ann_senate_maha_CeoDon_SpLob"   
[27] "MSets_manuf_ann_senate_maha_EmpDon_AnyLob"  
[28] "MSets_manuf_ann_senate_maha_EmpDon_CommLob" 
[29] "MSets_manuf_ann_senate_maha_EmpDon_CoSpLob" 
[30] "MSets_manuf_ann_senate_maha_EmpDon_SpLob"   
[31] "MSets_manuf_ann_senate_maha_GovDon_AnyLob"  
[32] "MSets_manuf_ann_senate_maha_GovDon_CommLob" 
[33] "MSets_manuf_ann_senate_maha_GovDon_CoSpLob" 
[34] "MSets_manuf_ann_senate_maha_GovDon_SpLob"   
[35] "MSets_manuf_ann_senate_maha_PacDon_AnyLob"  
[36] "MSets_manuf_ann_senate_maha_PacDon_CommLob" 
[37] "MSets_manuf_ann_senate_maha_PacDon_CoSpLob" 
[38] "MSets_manuf_ann_senate_maha_PacDon_SpLob"

For Figure I1:
-- put in data/figI1
[1] "msets_ann_house_cbps"    
[2] "msets_ann_house_maha"    
[3] "msets_ann_house_norefine"
[4] "msets_ann_sen_cbps"      
[5] "msets_ann_sen_maha"      
[6] "msets_ann_sen_norefine"

For Figure J.2:
-- put in data/figJ2
[1] "EstObj_manuf_ann_senate_maha_AnyDon_AnyLob_jop_naics3"
[2] "MSets_manuf_ann_senate_maha_AnyDon_AnyLob_jop_naics3"

For Figure K.1:
-- put in data/figK1
[1] "donation_lobby_quarterly_revcause_1_senate_maha_SpLob_AnyDon_govtrack_EstimateObj"   
[2] "donation_lobby_quarterly_revcause_11_senate_maha_CommLob_AnyDon_govtrack_EstimateObj"
[3] "donation_lobby_quarterly_revcause_16_senate_maha_AnyLob_AnyDon_govtrack_EstimateObj" 
[4] "donation_lobby_quarterly_revcause_6_senate_maha_CoSpLob_AnyDon_govtrack_EstimateObj"


